import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        System.out.println(isPalindrome(121));
    }
    public static boolean isPalindrome(int x) {//用栈的方法解决回文数问题
        if(x<0){
            return false;
        }
        Stack<Integer> stack=new Stack<>();
        int cur=x;
        while(cur>0){
            stack.push(cur%10);
            cur/=10;
        }
        while(x>0){
            if(x%10!=stack.peek()){
                return false;
            }
            stack.pop();
        }
        return true;
    }
    public static boolean isPalindrome2(int x){

    }
}